def to_decimal(binary: str) -> int:
    demical = 0
    for i, val in enumerate(binary, start=1):
        demical += int(val) * 2**(len(binary) -i)
    return demical


if __name__ == '__main__':
    print(to_decimal('1010'))